﻿using Oliving.Edge.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace Oliving.Edge.Init
{
    public class SystemInit
    {

        public static void Folders()
        {

            // 文件夹 
            string path = Appsettings.app(new string[] { "EdgeFileOptions", "FileBaseUrl" });

            string pathA = Appsettings.app(new string[] { "PictureOptions", "ImageBaseUrl" });


            isDirectoryFile(path);
            isDirectoryFile(pathA);


        }


        /// <summary>
                /// 检测文件夹是否存在
                /// </summary>
                /// <param name="Filename"></param>
                /// <returns></returns>
        private static bool isDirectoryFile(string Filename)
        {
            if (Directory.Exists(Filename))
            {
                //Directory.CreateDirectory(Server.MapPath("../FileTemp" + Filename)); //创建新文件夹
                //Directory.Delete(Server.MapPath("../FileTemp" + Filename), true);  //删除新文件夹
                return true;
            }
            else
            {
                Directory.CreateDirectory(Filename); //创建新文件夹
                return false;
            }
        }



    }
}
